From a2a686df0067f2f7e21a56a9347fe88b51700e76 Mon Sep 17 00:00:00 2001 From: "kaf24@localhost.localdomain" Date: Sat, 19 Aug 2006 10:21:02 +0100 Subject: [PATCH] [XENBUS] Cleanup correctly on suspend, unregister watches. Again needed for domU kexec, so the next kernel instance can register watches without running into -EBUSY. Signed-off-by: Gerd Hoffmann --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index d7f6793d48..190fa1e794 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -665,7 +665,17 @@ EXPORT_SYMBOL_GPL(unregister_xenbus_watch); void xs_suspend(void) { + struct xenbus_watch *watch; + char token[sizeof(watch) * 2 + 1]; + down_write(&xs_state.suspend_mutex); + + /* No need for watches_lock: the suspend_mutex is sufficient. */ + list_for_each_entry(watch, &watches, list) { + sprintf(token, "%lX", (long)watch); + xs_unwatch(watch->node, token); + } + mutex_lock(&xs_state.request_mutex); } -- 2.30.2